from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import Optional
from datetime import datetime
from module_admin.annotation.pydantic_annotation import as_query

class BusinessModel(BaseModel):
    """
    营业记录表对应pydantic模型
    """

    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)

    id: Optional[int] = Field(default=None, description='ID')
    m_id: Optional[int] = Field(default=None, description='机台ID')
    CurTimel: Optional[datetime] = Field(alias='CurTimel', default=None, description='客户端上传时间')
    TotalInNum: Optional[int] = Field(alias='TotalInNum', default=None, description='总进分数')
    TotalOutNum: Optional[int] = Field(alias='TotalOutNum', default=None, description='总退分数')
    CurInOutBFB: Optional[str] = Field(alias='CurInOutBFB', default=None, description='进退金额百分比')
    TotalPlayFNum: Optional[str] = Field(alias='TotalPlayFNum', default=None, description='总玩金额')
    TotalWinFNum: Optional[str] = Field(alias='TotalWinFNum', default=None, description='总赢金额')
    CurPlayOrWinBFB: Optional[str] = Field(alias='CurPlayOrWinBFB', default=None, description='总玩金额与总赢金额百分比')
    TotalPlayCNum: Optional[int] = Field(alias='TotalPlayCNum', default=None, description='总玩次数')
    TotalWinCNum: Optional[int] = Field(alias='TotalWinCNum', default=None, description='总赢次数')
    CurPlayCountOrWinCount: Optional[str] = Field(alias='CurPlayCountOrWinCount', default=None, description='总玩次数与总赢次数百分比')
    LastTimel: Optional[datetime] = Field(alias='LastTimel', default=None, description='上期记录时间')
    LastTotalInNum: Optional[int] = Field(alias='LastTotalInNum', default=None, description='上期总进分数')
    LastTotalOutNum: Optional[int] = Field(alias='LastTotalOutNum', default=None, description='上期总退分数')
    LastInOutBFB: Optional[str] = Field(alias='LastInOutBFB', default=None, description='上期进退分数百分比')
    LastTotalPlayFNum: Optional[int] = Field(alias='LastTotalPlayFNum', default=None, description='上期总玩分数')
    LastTotalWinFNum: Optional[int] = Field(alias='LastTotalWinFNum', default=None, description='上期总赢分数')
    LastPlayOrWinBFB: Optional[str] = Field(alias='LastPlayOrWinBFB', default=None, description='上期总赢分数总玩分数百分比')
    LastTotalPlayCNum: Optional[int] = Field(alias='LastTotalPlayCNum', default=None, description='上期总玩次数')
    LastTotalWinCNum: Optional[int] = Field(alias='LastTotalWinCNum', default=None, description='上期总赢次数')
    LastTotalWinOrPlayCNum: Optional[str] = Field(alias='LastTotalWinOrPlayCNum', default=None, description='上期总玩次数总赢次数百分比')
    add_time: Optional[int] = Field(default=None, description='创建时间')

class BusinessQueryModel(BusinessModel):
    """
    营业记录表不分页查询模型
    """

    begin_time: Optional[str] = Field(default=None, description='开始时间')
    end_time: Optional[str] = Field(default=None, description='结束时间')


@as_query
class BusinessPageQueryModel(BusinessQueryModel):
    """
    营业记录表分页查询模型
    """
    page_num: int = Field(default=1, description='当前页码')
    page_size: int = Field(default=10, description='每页记录数')